package grape.workflow.rest.flowable.ext;

import org.flowable.common.engine.impl.AbstractEngineConfiguration;
import org.flowable.idm.engine.IdmEngineConfiguration;
import org.flowable.idm.engine.configurator.IdmEngineConfigurator;
import org.flowable.idm.spring.SpringIdmEngineConfiguration;
import org.flowable.spring.boot.BaseEngineConfigurationWithConfigurers;
import org.flowable.spring.boot.EngineConfigurationConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 扩展idm的配置
 * Created by yangwei
 * Created at 2020/6/8 19:09
 */
@Configuration
public class CustomIdmEngineConfiguration implements EngineConfigurationConfigurer<SpringIdmEngineConfiguration> {

    @Bean
    public CustomGroupEntityManager customGroupEntityManager(){
        return new CustomGroupEntityManager();
    }
    @Bean
    public CustomUserEntityManager customUserEntityManager(){
        return new CustomUserEntityManager();
    }

    @Override
    public void configure(SpringIdmEngineConfiguration engineConfiguration) {
        engineConfiguration.setGroupEntityManager(customGroupEntityManager());
        engineConfiguration.setUserEntityManager(customUserEntityManager());
    }
}
